<template>
  <!--登录组件-->

  <div id="login">
<!--    <img src="../assets/sognshulogo.svg" style="width: 160px; margin: 10px 170px"/>-->
   <div class="logo"></div>
    <!--    账号-->
    <el-input class="number" v-model="student.name" placeholder="请输入内容" type="primary" icon="el-icon-user-solid "
              prefix-icon="el-icon-user-solid"></el-input>
    <!--    密码-->
    <el-input class="padding" placeholder="请输入密码" v-model="student.padding" show-password
              prefix-icon="el-icon-lock"></el-input>
    <!--    登陆注册-->
    <ul class="submit">
      <el-button class="left" type="primary" @click="save">登录</el-button>
      <el-button class="right" type="info" @click="quxiao">注册</el-button>
    </ul>
  </div>
</template>

<script>
export default {
  name: "login",
  data() {
    return {
      student:{}
    }
  },
  methods:{
    de(id){
      this.$http.get('http://localhost:8082/student/de?id='+id).then(res=>{
        console.log(res);
        this.student=res.data;
      })
    },
    findStundentById(id){
      this.$http.get('http://localhost:8082/student/findStundentById?id='+id).then(res=>{
        console.log(res);
        this.student=res.data;
      })
    },
    save(){
      this.$http.push("http://localhost:8082/student/update",this.student).then(res=>{
        this.$router.push("/Home")
      })
    },
   quxiao(){
     this.$router.push("/login")
   },
    created() {
      console.log(this.$route.query.id)
      this.student.id= this.$route.query.id;
      this.findStundentById(this.$route.query.id);
      /*数据库去查询根据id*/
    }

  }
}
</script>

<style scoped>

#login{
  width: 500px;
  height: 500px;
  /*box-shadow: 7px 19px 50px #4c1805, -7px -4px 40px #4c1805;*/
  box-shadow: 0px 0px 50px #727294, 0px 0px 13px #727294;
  margin: 0 auto;
  position: relative;

}
#login .logo{
  width: 100%;
  height: 180px;
  background: url(../assets/haitlogo.svg);
  background-position:40px 250px;
}
.number {
  width: 300px;
  margin: 20px 100px;
}

.padding {
  width: 300px;
  margin: 10px 100px;
}
.submit .left {
margin-left: 100px;
}
.submit .right {
margin-left: 40px;
}
</style>
